 <?php 
 
 function word_limiter( $text, $limit = 90, $chars = '0123456789' ) {
    if( strlen( $text ) > $limit ) {
        $words = str_word_count( $text, 2, $chars );
        $words = array_reverse( $words, TRUE );
        foreach( $words as $length => $word ) {
            if( $length + strlen( $word ) >= $limit ) {
                array_shift( $words );
            } else {
                break;
            }
        }
        $words = array_reverse( $words );
        $text = implode( " ", $words ) . ' (...)';
    }
    return $text;
}



 get_header(); ?>

    <div id="main">
               
        <?php echo do_shortcode("[metaslider id=81]"); ?>

        <div id="primary">

            <div id="column-1">

                <img id="col1-title" src="<?php bloginfo('template_directory'); ?>/img/institucional.png" alt="Institucional">

                    <p id="col1-content">

                        <?php $recent = new WP_Query("page_id=2"); $recent->the_post();?>
                        <?php the_content(); ?>


                    </p>


            </div>  <!-- end column-1 -->  

            <img id="vertical_bar" src="<?php bloginfo('template_directory'); ?>/img/vertical_bar.png" alt="|">

            <div id="column-2">

                <img id="col2-title" src="<?php bloginfo('template_directory'); ?>/img/areas_atuacao.png" alt="Áreas de Atuação">

                    <p id="col2-content">

                        <?php $recent = new WP_Query("page_id=16"); $recent->the_post();?>
                        <?php the_content(); ?>

                    </p>


            </div> <!-- end column-2 -->

        </div> <!-- end primary -->

        <div id="secondary">


            <img id ="ultimas_novidades" src="<?php bloginfo('template_directory'); ?>/img/ultimas_novidades.png" alt="Últimas novidades">
            
            
            
            
            <?php $query_string="tag=informativo";

                query_posts($query_string . '&posts_per_page=4');
            
                if(have_posts()) : for($loopcount=1;have_posts();$loopcount++) : the_post(); 
                 
                    if ($loopcount!=1): ?>
                        <img class="news_separator" src="<?php bloginfo('template_directory'); ?>/img/underline_ultimas_novidades.png" alt="------------------------">
                    <?php endif; ?>
                    
                <div class="news">

                    <p class="date"> <a href="<?php the_permalink(); ?>"><?php the_time('d-m-Y'); ?></a> </p>

                    <p class="content"><a href="<?php the_permalink(); ?>">
                        <?php
                        
                        echo word_limiter( get_the_content() ) ;
                                                
                        ?>

                    </p></a>

                </div> <!-- end news -->


            <?php endfor; ?>

    
            <?php endif; ?>
            
            
            
            
           
        </div> <!-- end secondary -->

        
        
        <a href="<?php bloginfo('url'); ?>/informativo-menu/"><img id="news_saibamais" src="<?php bloginfo('template_directory'); ?>/img/saibamais.png" alt="Saiba mais"></a>
            
        <img id="main_close" src="<?php bloginfo('template_directory'); ?>/img/underline_main.png" alt=".......................................................................">


    </div> <!-- end main -->

</div> <!-- end wrap (header.php)-->



<?php get_footer(); ?>